<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>悬停3D发光效果</title>
</head>

<body>
    <h2>
        https://zhuanlan.zhihu.com/p/638068951
    </h2>
    

    <img src="https://picsum.photos/200/300" />
    <img src="https://picsum.photos/200/300" />
    <style>
        img {
            --a: 8deg;
            /* control the angle of rotation (the smaller, the better) */
            width: 250px;
            aspect-ratio: 1;
            border-radius: 20px;
            transform: perspective(400px) rotate3d(var(--r, 1, -1, 0), calc(var(--i, 1)*var(--a)));
            -webkit-mask:
                linear-gradient(135deg, #000c 40%, #000, #000c 60%) 100% 100%/250% 250%;
            transition: .4s;
            cursor: pointer;
        }

        img:hover {
            --i: -1;
            -webkit-mask-position: 0 0;
        }


        body {
            margin: 0;
            min-height: 100vh;
            display: grid;
            place-content: center;
            grid-auto-flow: column;
            gap: 80px;
            background: #000;
        }
    </style>

</body>

</html>